package com.orange.wwwapi.controller.venue;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.orange.core.pojo.PageReqDto;
import com.orange.core.pojo.R;
import com.orange.core.pojo.entity.venue.vo.VenueVO;
import com.orange.core.pojo.req.venue.VenuePageReq;
import com.orange.core.service.venue.VenueService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>ClassName:VenueController</p>
 * <p>Description: 场地管理</p>
 * <p>Author: lwm</p>
 * <p>Date: 2025/5/22 0:17</p>
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/venue")
public class VenueController {

    private final VenueService venueService;

    /**
     * 场地分页查询
     *
     * @param pageReqDto
     * @return
     */
    @PostMapping("/page")
    public R<Page<VenueVO>> page(@RequestBody PageReqDto<VenuePageReq> pageReqDto){
        Page<VenueVO> page = venueService.page(pageReqDto);
        return R.ok(page);
    }

    /**
     * 场地详情
     * @param id
     * @return
     */
    @GetMapping("/info/{id}")
    public R<VenueVO> info(@PathVariable("id") int id){
        return R.ok(venueService.info(id));
    }


}
